#ifndef _APP_DEBUG_H_
#define _APP_DEBUG_H_

#define Mobvoi_OCF 0XE0
#define TX_FIFO_THRD 0x40
#define RX_FIFO_THRD 0x40
#define HCI_EVENT_HEAD_LENGTH 0X03
#define HCI_COMMAND_HEAD_LENGTH 0X04

typedef struct
{
    unsigned char code; /**< 0x01: HCI Command Packet
                                         0x02: HCI ACL Data Packet
                                         0x03: HCI Synchronous Data Packet
                                         0x04: HCI Event Packet */
    struct
    {
        unsigned short ocf : 10; /**< OpCode Command Field */
        unsigned short ogf : 6;  /**< OpCode Group Field */
    } __PACKED_POST__ opcode;
    unsigned char total;
    unsigned char param[];
} __PACKED_POST__ HCI_PACKET;

typedef struct
{
    unsigned char code; /**< 0x01: HCI Command Packet
                                         0x02: HCI ACL Data Packet
                                         0x03: HCI Synchronous Data Packet
                                         0x04: HCI Event Packet */
    struct
    {
        unsigned short ocf : 10; /**< OpCode Command Field */
        unsigned short ogf : 6;  /**< OpCode Group Field */
    } __PACKED_POST__ opcode;
    unsigned char total;
    unsigned char cmd; /**< private command */
    unsigned char param[];
} __PACKED_POST__ HCI_COMMAND_PACKET;

typedef struct
{
    unsigned char code;  /**< 0x01: HCI Command Packet
                                         0x02: HCI ACL Data Packet
                                         0x03: HCI Synchronous Data Packet
                                         0x04: HCI Event Packet */
    unsigned char event; /**< 0x00-0xFF: Each event is assigned a 1-Octet event code used to uniquely identify different types of events*/
    unsigned char total; /**< Parameter Total Length */
    unsigned char param[];
} __PACKED_POST__ HCI_EVENT_PACKET;

typedef struct
{
    unsigned int addr;
    unsigned int value;
} __PACKED_POST__ REGISTER_PARAM;

typedef struct
{
    unsigned int addr;
    unsigned char len;
    unsigned char data[];
} __PACKED_POST__ FLASH_PARAM;

void uart_initialise(uint32_t baud_rate);
void uart_gpio_disable(void);
void uart_gpio_enable(void);

#endif
